package com.gdougms.service.Impl;

import com.gdougms.entity.Field;
import com.gdougms.mapper.FieldMapper;
import com.gdougms.service.FieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class FieldServiceImpl implements FieldService {

    @Autowired
    FieldMapper fieldMapper;

    @Override
    public List<Field> fieldList() {
        return fieldMapper.fieldList();
    }

    @Override
    public int addField(String name,String area,BigDecimal cost) {
        return fieldMapper.addField(name, area, cost);
    }

    @Override
    public int deleteFieldById(Integer id) {
        return fieldMapper.deleteFieldById(id);
    }

    @Override
    public int updateFieldStateById(String name, String area, BigDecimal cost, Integer id,Integer state) {
        return fieldMapper.updateFieldStateById(name, area, cost, id,state);
    }

    @Override
    public List<String> getAllArea() {
        return fieldMapper.getAllArea();
    }

    @Override
    public List<BigDecimal> getAllCost() {
        return fieldMapper.getAllCost();
    }

    @Override
    public List<Field> getAllFieldByArea(String area) {
        return fieldMapper.getAllFieldByArea(area);
    }

    @Override
    public List<Field> getAllFieldByCost(BigDecimal cost) {
        return fieldMapper.getAllFieldByCost(cost);
    }
}
